package main

import (
	"fmt"
	"math/rand"
	"time"
)

// 升级随机点名系统
func main() {
	var a string
	var lst1 []string
	rand.Seed(time.Now().UnixNano())
	roster := []string{"关学业", "汪海", "王亚林", "戚千叙", "王浩", "蔡徐坤"}
	for {
		for {
			fmt.Println("开始随机点名，按q退出")
			fmt.Scan(&a)
			if a == "q" {
				return
			} else {
				if len(lst1) == len(roster) {
					fmt.Println("全部人员都已经抽完")
					return
				}
				f := 0
				randnum := rand.Intn(len(roster))
				for j := 0; j < len(lst1); j++ {
					if lst1[j] == roster[randnum] {
						fmt.Println("改人员已经抽过了")
						f = 1
					}
				}
				if f != 1 {
					fmt.Println("点到名的是：", roster[randnum])
					lst1 = append(lst1, roster[randnum])
				}
			}
		}
	}
}
